<?php
/*
* Smarty plugin
* -------------------------------------------------------------
* Fichier :  insert.time.php
* Type :     temps
* Nom :      time
* Rôle :     Insert la date/heure courante conformément
*            au format
* -------------------------------------------------------------
*/
function smarty_insert_lolita($params, &$smarty)
{

    $pars = array('type'=>'buttons','class'=>'');

    $p = array_merge($pars,$params);

    $ret = '';

    $id = getUid();
    switch($p['type']){
      case 'buttons':
        $ret = <<<RET
    <script>
    jQuery(function($){
      $('#$id').buttonset();
    });
    </script>
    <span class="btn-validation {$p['class']}" id="$id">
      <button type="submit">Valider</button>
      <button type="reset">Annuler</button>
    </span>
RET;
        break;
      case 'button':
        $ret = <<<RET
    <script>
    jQuery(function($){
      $('.btn-validation').buttonset();
    });
    </script>
    <span class="btn-validation {$p['class']}">
      <button type="submit">Valider</button>
    </span>
RET;
        break;
    case 'button_duppli':
      $ret = <<<RET
    <script>
    jQuery(function($){
      com.lolita.display.makeDuppliBtnGrp({
        "afterClone" : function(\$line){
            com.lolita.display.makeMemberPick(\$line.find('.ac-jouteur').removeClass('loli-ac-membre'),null,{"onEmpty" : {"id":0,"label":"Anne Onymous"}});
        }

     });
    });
    </script>

    <button type="button" class="add" title="Ajouter une ligne">+</button>
    <button type="button" class="del" title="Supprimer la ligne">-</button>
RET;
      break;
    case 'report':
      $ret = <<<RET
<div class="ajax-report" style="display: none"></div>
RET;
      break;
    }

    return $ret;
}
?>